package handler

import (
	"github.com/cz-it/aps/src/proto"

	"net/http"
	"encoding/json"
)

type Agent struct {
	Channel   string
	Openid    string
	PubKey    string
	Signature string
}

func ClientHdl(w http.ResponseWriter, r *http.Request){
	agent  := new(Agent)
	agent.Channel   = r.FormValue("channel")
	agent.Openid    = r.FormValue("openid")
	agent.PubKey    = r.FormValue("pubkey")
	agent.Signature = r.FormValue("signature")
	
	rst := agent.Proc()
	w.Write(rst)
}

func (agent *Agent) Proc() []byte {
	d := proto.Ciphertext{"fasfsafsafsefwfwefwe"}
	r := proto.Response{"rep_login","success",d}
	b,err:= json.Marshal(r)
	if err != nil {
		panic(err)
	}
	return b
}



















